<%@ page import="java.io.File" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/10/18
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>文件列表</title>
    <script src="/webjars/jquery/3.6.0/jquery.min.js"></script>
    <link rel="stylesheet" href="/webjars/bootstrap/3.4.1/css/bootstrap.min.css">
    <script src="/webjars/bootstrap/3.4.1/js/bootstrap.min.js"></script>
    <style>
        .container{
            width: 500px;
            margin-top: 20px;
        }
        .form-control{
            margin: 10px 5px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <div class="panel-title">
                    <h4>文件上传</h4>
                </div>
            </div>
            <div class="panel-body">
                <%
                    String realPath = application.getRealPath("/upload");
                    File dirs = new File(realPath);
                    File[] files = dirs.listFiles();
                    for (File file : files) {
                        out.println("<li><a href='/user/download.do?fileName="+file.getName()+"'>" + file.getName() + "</a></li>");
                    }

                %>
            </div>
            <div class="panel-footer text-right">
                <a href="/upload.jsp" class="btn btn-danger btn-sm">继续上传</a>
                泽林教育2021.
            </div>
        </div>

    </div>

</body>
</html>
